<?php
namespace API\Controller;
use Think\Controller;
class ClubserviceController extends Controller {
  public function getAllTrain(){
    	$trainModel=M('train'); 
		$train=$trainModel->select(); //查询
   echo json_encode($train);

    }
   public function getTrainbyId(){
   	    $trid=$_GET['tr_id'];
        $trainModel=M('train'); 
		$train=$trainModel->where("tr_id='$trid'")->select(); //查询
        echo json_encode($train);

   } 
   public function getAllClub(){
   	$clubModel=M('club_info');
   	$club=$clubModel->select();
   	echo json_encode($club);
   }
   public function getClubbyId(){
   	$club_id=$_GET['club_id'];
   	$clubModel=M('club_info');
   	$club=$clubModel->where("club_id='$club_id'")->select();
   	echo json_encode($club);
   }
   public function getmaster(){
   	$club_id=$_GET['club_id'];
   	$masterModel=M('club_master');
   	$master=$masterModel->join("club_info on club_master.club_id='$club_id'")->select();
   	echo json_encode($master);
   }
   public function getmasterbyId(){
   	$club_id=$_GET['club_id'];
   	$master_id=$_GET['club_master_id'];
   	$masterModel=M('club_master');
   	$master=$masterModel->where("club_master_id='$master_id'")->join("club_info on club_master.club_id='$club_id'")->select();
   	echo json_encode($master);
   }
   public function getClubvideos(){
     $club_id=$_GET['club_id'];
     $videoModel=M('club_video');
     $video=$videoModel->join("club_info on club_intro.club_id='$club_id'")->field('club_video_id,club_video_name,club_video_file,club_video_date,club_video.club_id')->select();
   	echo json_encode($video);
   }
   public function getClubvideosbyId(){
     $club_video_id=$_GET['club_video_id'];
     $club_id=$_GET['club_id'];
     $videoModel=M('club_video');
     $video=$videoModel->where("club_video_id='$club_video_id'")->join("club_info on club_info.club_id='$club_id'")->field('club_video_id,club_video_name,club_video_file,club_video_date,club_video.club_id')->select();
   	echo json_encode($video);
   }
}